package tree

import "fmt"

type BinaryNode struct {
	Lchild *BinaryNode
	Rchild *BinaryNode
	Data   interface{}
	// Parent *BinaryNode
}

func (n BinaryNode) BEmpty() bool {
	return false
}

func (n BinaryNode) BDepth() {

}

func (n BinaryNode) BRoot() BinaryNode {
	return n
}

func (n BinaryNode) BValue() interface{} {
	return 'a'
}

func (n BinaryNode) BAssign(node *BinaryNode) {

}

func (n BinaryNode) Bparent() {

}

func (n BinaryNode) BLeftChild() {

}

func (n BinaryNode) BRightChild() {

}

func (n BinaryNode) BLeftSibling() {

}

func (n BinaryNode) BRightSibling() {

}

func (n BinaryNode) PreOrderTraverse(tree *BinaryNode) {
	if tree == nil {
		return
	}

	fmt.Print(tree.Data, " ")
	n.PreOrderTraverse(tree.Lchild)
	n.PreOrderTraverse(tree.Rchild)
}

func (n BinaryNode) InOrderTraverse(tree *BinaryNode) {

	if tree == nil {
		return
	}
	n.InOrderTraverse(tree.Lchild)
	fmt.Print(tree.Data, " ")
	n.InOrderTraverse(tree.Rchild)
}

func (n BinaryNode) PostOrderTraverse(tree *BinaryNode) {
	if tree == nil {
		return
	}

	n.PostOrderTraverse(tree.Lchild)
	n.PostOrderTraverse(tree.Rchild)
	fmt.Print(tree.Data, " ")
}

func (n BinaryNode) LevelOrderTraverse() {

}
